<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		let arr = [5, 1, 3, 2, 4]

		// 冒泡排序
		function maopao(arr) {
			for (let i = 0; i < arr.length; i++) {
				for (let j = 0; j < arr.length - i - 1; j++) {
					if (arr[j] < arr[j + 1]) {
						let temp = arr[j + 1]
						arr[j + 1] = arr[j]
						arr[j] = temp
					}
				}
			}
			return arr
		}
		// 选择排序
		function selectionSort(arr) {
			let newArr = []
			for (let i = 0; i < arr.length; i++) {
				let min = arr[i],
					index = i
				for (let j = i + 1; j < arr.length; j++) {
					if (arr[j] < min) {
						min = arr[j]
						index = j
					}
				}
				newArr.push(min)
				arr.splice(index, 1)
				i--
			}
			return newArr
		}
		// 插入排序
		function insertionSort(arr) {
			let newArr = [arr[0]]
			for (let i = 1; i < arr.length; i++) {
				newArr.push(arr[i])
				for (let j = 0; j < newArr.length; j++) {
					// 最后一项
					let length = newArr.length - j
					if (newArr[length] < newArr[j]) {
						let temp = newArr[j]
						newArr[j] = newArr[length]
						newArr[length] = temp
					}
				}
			}
			return newArr
		}


		let obj = {
			张三: 76,
			李四: 67,
			王五: 70,
			赵六: 65
		}
		function fn(obj) {
			let arr = Object.entries(obj)
			let arrSort = arr.sort(function (a, b) { return a[1] - b[1] })
			return Object.fromEntries(arrSort)
		}


	</script>
</body>

</html>